package com.gateway.dao;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.gateway.entity.LogicServer;

public class ILogicServerDaoImpl extends BaseDao implements ILogicServerDao {

  public int add(LogicServer ls) {
    SqlSession session=openSession();
    try {
      return session.insert("LogicServerMapper.add", ls);
    } finally {
      session.close();
    }
  }

  public void delete(int id) {
    SqlSession session=openSession();
    try {
      session.delete("LogicServerMapper.delete", id);
    } finally {
      session.close();
    }
  }

  public List<LogicServer> selectAll() {
    SqlSession session=openSession();
    try {
      return session.selectList("LogicServerMapper.selectAll");
    } finally {
      session.close();
    }
  }

  public void update(LogicServer ls) {
    SqlSession session=openSession();
    try {
      session.update("LogicServerMapper.update", ls);
    } finally {
      session.close();
    }
  }

  public LogicServer selectById(int id) {
    SqlSession session=openSession();
    try {
      return session.selectOne("LogicServerMapper.selectById", id);
    } finally {
      session.close();
    }
  }
}
